using SqlQueryBuilder.Util;

namespace SqlQueryBuilder.Clauses
{
    /// <summary>
    /// IsNull Clause
    /// </summary>
    public class IsNull : IConditionalClause
    {
        private readonly string field;

        /// <summary>
        /// Initializes a new instance of the <see cref="Like"/> class.
        /// </summary>
        /// <param name="field">The field.</param>
        public IsNull(string field)
        {
            this.field = field;
        }

        /// <summary>
        /// Builds the where clause.
        /// </summary>
        /// <returns></returns>
        public string BuildConditionalClause()
        {
            return CreateClause();
        }

        /// <summary>
        /// Creates the clause.
        /// </summary>
        /// <returns></returns>
        private string CreateClause() 
        {
           return string.Format("{0} IS NULL", field);
        }
    }
}